import { usePagination } from '@/hooks/usePagination'
import useDictStore from '@/store/modules/dict'
import { ref } from 'vue'

export default function useResponseTable() {
  const isLoading = ref(false)
  const dictStore = useDictStore()
  const { api_param_type } = dictStore.getDicts('api_param_type')
  const { pagination, changePageNumber, changePageSize } = usePagination(onSearch)
  const columns: TableColumnList = [
    {
      label: '字段',
      prop: 'paramName',
      width: 150,
    },
    {
      label: '类型',
      prop: 'paramType',
      width: 100,
      formatter({ paramType }) {
        return api_param_type.getLabel(paramType)
      },
    },
    {
      label: '描述',
      prop: 'paramDesc',
      minWidth: 180,
    },
  ]

  function onSearch() {}

  return { isLoading, columns, pagination, changePageNumber, changePageSize }
}
